package com.icehand.springdocker.demo.convert;

import com.icehand.springdocker.demo.po.User;
import com.icehand.springdocker.demo.vo.UserDto;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
import org.mapstruct.Mappings;

import java.util.List;

@Mapper(componentModel = "spring", uses = UserTransform.class)
public interface UserDtoMapper {
    @Mappings({
            @Mapping(target = "gender", source = "sex")
    })
    User dot2User(UserDto userDto);

    @Mappings({
            @Mapping(target = "sex", source = "gender")
    })
    UserDto user2Dto(User user);

    List<UserDto> users2UserDtos(List<User> users);
}
